import pygame
import sys
from init_map import InitMap


class Map(InitMap):
    def __init__(self, *args):
        InitMap.__init__(self)

        self.door_iron = pygame.image.load("../资源/图片/铁门.png").convert_alpha()
        self.star_sword = pygame.image.load("../资源/图片/星光神剑.png").convert_alpha()
        self.star_shield = pygame.image.load("../资源/图片/光芒神盾.png").convert_alpha()
        self.prince_red = pygame.image.load("../资源/图片/红衣魔王.png").convert_alpha()
        self.prince_dark = pygame.image.load("../资源/图片/冥灵魔王.png").convert_alpha()

        self.hero_pos = (9, 10)
        self.up_pos = (5, 3)
        self.down_pos = (10, 10)
        self.variable_pos = {
            (2, 6): (self.door_iron, '铁门'),
            (8, 6): (self.door_iron, '铁门'),
            (2, 7): (self.star_sword, '星光神剑'),
            (8, 7): (self.star_shield, '光芒神盾'),
            (2, 5): (self.prince_red, '红衣魔王_ss'),
            (8, 5): (self.prince_red, '红衣魔王_ss'),
            (5, 6): (self.prince_dark, '冥灵魔王'),
        }

    def fixed_brick(self):
        self.draw(self.upstairs, self.up_pos[0], self.up_pos[1])
        self.dic[self.up_pos] = '上楼'
        self.draw(self.downstairs, self.down_pos[0], self.down_pos[1])
        self.dic[self.down_pos] = '下楼'
        for i in range(9):
            for j in range(9):
                if i != 1 and i != 4 and i != 7:
                    self.draw(self.wall, i+1, j+1)
                    self.dic[(i+1, j+1)] = '墙'
        for i in [(2, 8), (2, 9), (8, 8), (8, 9), (5, 1), (5, 2)]:
            self.draw(self.wall, i[0], i[1])
            self.dic[(i[0], i[1])] = '墙'
        for i in self.ls:
            self.screen.blit(self.road, i)
            self.dic[(int((i[0]-375)/48), int((i[1]-25)/48))] = '路'
